package com.ldk.framework.dao.impl;

import java.util.HashMap;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;
import org.springframework.util.Assert;

import com.ldk.base.framework.dao.impl.BaseDAO;
import com.ldk.framework.dao.ICommentDAO;
import com.ldk.framework.entity.Comment;

/**
* CommentDAO接口实现类
* @author xiangwl
*/
@Repository
public class CommentDAO extends BaseDAO<Comment> implements ICommentDAO {

	@Override
	public double calculateStar(String dbKey, String driverOpenId) {
		Assert.notNull(driverOpenId);
		try{
			Map<String, Object> parms = new HashMap<String, Object>();
			parms.put("driverOpenId", driverOpenId);
			
			SqlSession sqlSession = getSqlSession(dbKey);
			return sqlSession.selectOne(getSqlName("calculateStar"), parms);
		}
		catch(Exception e){
			logger.error(e.getMessage());
		}
		return 0;
	}

}
